package com.litch.mvpdemo.model.impl;

import android.util.Log;

import com.litch.mvpdemo.model.PhoneByAddModel;
import com.litch.mvpdemo.model.entity.PhoneByAdd;
import com.litch.mvpdemo.utils.HttpUtil;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

/**
 * Created by Administrator on 2016/7/11.
 */
public class PBAModelImpl implements PhoneByAddModel, Callback{
    private static final String BD_URL = "http://apis.baidu.com/apistore/mobilenumber/mobilenumber";
    @Override
    public void loadPhoneByAdd(String phone, ModelCallBack callBack) {
        String url = BD_URL+"?phone=" + phone;
        Log.e("request=",url);
        HttpUtil.getInstence().doGet(url,this);
    }

    @Override
    public void onFailure(Call call, IOException e) {

    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
        String body = response.body().string();
        Log.e("body=",body);
    }

    public static interface ModelCallBack{
        void onOk(PhoneByAdd add);
    }
}
